package combinatorics;


/**
 * author :  apurv verma
 * email  :  dapurv5@gmail.com
 */

/*
 * UTILITY: Can find all possible combinations of elements of an array.
 */

public class MAIN {
	
	
	//USAGE
	
	public static void main(String args[]){
		long t1=System.currentTimeMillis();
		
		//1. CREATE A LIST FOR WHICH YOU WANT TO GENERATE THE COMBINATIONS.
		Integer List[]=new Integer[]{0,1,2,3,4,5,6};
		
		//2. INITIALIZE r
		int r=4;
		
		//3. CREATE THE 2D ARRAY IN WHICH YOU WANT THE RESULT.
		Object combination[][]=Combinations.combinations(List,r);
		
		//4. PRINT THE RESULT
		for(int i=0;i<Combinations.nCr;i++){
			for(int j=0;j<r;j++){
			System.out.print(combination[i][j]);
			}
			System.out.println();
		}
		
		long t2=System.currentTimeMillis();
		System.out.println(t2-t1+" ms");
		
	}		
}
